<!DOCTYPE html>
<html xmlns="http://java.sun.com/jsf/html">
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>字典码管理</title>
		<link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css" />
		<link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css" />
	</head>
	<!--<div class="search-cont clearfix" id="tool">
		<div class="operation-btn-cont">
			<div class="operright cyt-retract-close hideMenu">
				收起筛选<i class="iconfont">&#xe658;</i>
		sysDict			<div class="operright cyt-retract-open showMenu" style="display: none;">
				展开筛选<i class="iconfont">&#xe936;</i>
			</div>
			<@shiro.hasPermission name="sys:role:add">
			<button class="layui-btn layui-btn-normal layui-btn-mid addBtn" type="button" data-tab-name="字典类型添加"  data-id="dictAddOrEdit" data-url="/sys/dict/dictEdit"><i class="iconfont marr5">&#xe65e;</i>添加</button>
		</@shiro.hasPermission>
		<@shiro.hasPermission name="sys:role:del">
		<button class="layui-btn layui-btn-normal layui-btn-mid deleteBtn" type="button" data-url="/baseDict/removeByIds"><i class="iconfont marr5">&#xe6a3;</i>删除</button>
	</@shiro.hasPermission>
	<div class="triangle-bottom"></div>
	<div class="triangle-top"></div>-->
	<body class="wrap-container clearfix">
	<div class="column-content-detail">
	<form class="layui-form">
		<div class="search-cont clearfix" id="tool">
			<div class="operation-btn-cont">
				<div class="operright cyt-retract-close hideMenu">
					收起筛选<i class="iconfont">&#xe658;</i>
				</div>
				<div class="operright cyt-retract-open showMenu" style="display: none;">
					展开筛选<i class="iconfont">&#xe936;</i>
				</div>
				<button class="layui-btn layui-btn-normal layui-btn-mid " type="button" data-tab-name="字典类型添加"  id="dictAddOrEdit" ><i class="iconfont marr5">&#xe65e;</i>添加</button>
				<button class="layui-btn layui-btn-normal layui-btn-mid deleteBtn" type="button" data-url="/sysDict/removeByIds"><i class="iconfont marr5">&#xe6a3;</i>删除</button>
				<div class="triangle-bottom"></div>
				<div class="triangle-top"></div>
			</div>
			<div class="search-details">
				<div class="layui-form-item marb5">
					<div class="layui-inline">
						<label class="layui-form-label w75">字典名称：</label>
						<div class="layui-input-inline">
							<input type="text" name="name" id="name" placeholder="请输入字典名称" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label w75">字典类型：</label>
						<div class="layui-input-inline">
							<input type="text" name="code" id="code" placeholder="请输入字典类型" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label w75">字典标签：</label>
						<div class="layui-input-inline">
							<input type="text" name="tag" id="tag" placeholder="请输入字典标签" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label w75">状态：</label>
						<div class="layui-input-inline">
							<select name="status" id="status">

							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label w75">类型：</label>
						<div class="layui-input-inline">
							<select name="dictKind" id="dictKind">

							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label w75">级别：</label>
						<div class="layui-input-inline">
							<select name="dictGrade" id="dictGrade">

							</select>
						</div>
					</div>
					<div class="layui-inline marl8">
						<button class="layui-btn layui-btn-normal" type="button" lay-submit="" lay-filter="seacherBtn">搜索</button>
						<button class="layui-btn layui-btn-normal" type="reset" >重置</button>
					</div>
				</div>
			</div>
	</div>
	</form>


			<div class="layui-form mart10" id="table-list">
				<table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
			</div>
	</div>
	<!--操作-->
	<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
	<script>
        layui.use(['jquery','table','page'],function(){
            var $ = layui.jquery,
            table = layui.table,
            page = layui.page;
            var tableIns=null;
            page.initDict("base_status,dict_classic,dict_grade",function (dictData) {
                page.showDict($("#status"),page.aceeptDictContentList(dictData,"base_status"),"请选择状态");
                page.showDict($("#dictKind"),page.aceeptDictContentList(dictData,"dict_classic"),"请选择类型");
                page.showDict($("#dictGrade"),page.aceeptDictContentList(dictData,"dict_grade"),"请选择级别");
                var url="/sysDict/page";
                var cols=[
                    {type: 'checkbox', fixed: 'left'},
                    {type: 'numbers', title: '序号'},
                    {field: 'name', title: '字典名称',align:'center'},
                    {field: 'code', title: '字典类型',align:'center'},
                    {field: 'status', title: '状态',width:100,align:'center', templet:function(d){

                        if(d.status=="1"){
                            return '<span class="status-green">'+page.aceeptDictContentName(dictData,"base_status",d.status)+'</span>';
                        }else {
                            return '<span class="status-grey">'+page.aceeptDictContentName(dictData,"base_status",d.status)+'</span>';
                        }
                    }},
                    {field: 'dictKind', title: '类型',width:100,align:'center', templet:function(d){
                        if(d.dictKind=="1"){
                            return '<span class="status-green">'+page.aceeptDictContentName(dictData,"dict_classic",d.dictKind)+'</span>';
                        }else {
                            return '<span class="status-grey">'+page.aceeptDictContentName(dictData,"dict_classic",d.dictKind)+'</span>';
                        }
                    }},
                    {field: 'dictGrade', title: '级别',width:100,align:'center', templet:function(d){
                        return page.aceeptDictContentName(dictData,"dict_grade",d.dictGrade);

                    }},
                    {field: 'remark', title: '备注',align:'center'},
                    {field: 'createTime', title: '创建时间',width:190, align:'center', templet:function(d){
                        return new Date(d.createTime).Format("yyyy-MM-dd hh:mm:ss");
                    }},
                    {title: '操作',width:190, align:"center",fixed: 'right', templet:function(d){
                    	var str='';
                       	if(d.dictGrade=='1'){
                       	    //系统级别
                            str='<a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-purple"  lay-event="add">字典</a>';
						}else{
                            //业务级别
                            str='<a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-purple"  lay-event="add">字典</a>'+
                                '<a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green"  lay-event="edit">编辑</a>'+
                            '<button class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-red" lay-event="del">删除</button>';
						}
                        return str;
                    }}
                ];
                tableIns=page.initDate(cols,url);
            });
            //监听行工具事件
            table.on('tool(entityList)', function(obj){
                var layEvent = obj.event,
                    data = obj.data;
                debugger
                if(layEvent === 'add'){ //字典
					if(data.dictKind=='2'){
                        page.edit("dictContentList","/sysDict/getDictContent?code="+data.code,"字典数据添加");
                    }else{
                        page.edit("dictContentList","/sysDict/getDictContentRun?code="+data.code,"字典数据添加");
                    }
                }else if(layEvent === 'edit'){ //编辑
					tabChange()
                    page.editPopup("/sysDict/getEdit?id="+data.id,"字典类型编辑");
                }else if(layEvent === 'del'){ //删除
                    page.delete("/sysDict/removeByIds", {"id":data.id,"_method":"DELETE"},"确定删除字典码吗？",function (data) {
                        tableIns.reload();
                    });
                }
            });
            $("#dictAddOrEdit").bind("click",function () {
                page.editPopup("/sysDict/getEdit","字典类型添加");
            });
        });
	</script>
	</body>

</html>